import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';

class PreviewPhotoPage extends StatefulWidget {
  String filePath;

  PreviewPhotoPage({Key? key, required this.filePath}) : super(key: key);

  @override
  _PreviewPhotoPageState createState() => _PreviewPhotoPageState();
}

class _PreviewPhotoPageState extends State<PreviewPhotoPage> {
  @override
  void initState() {
    // SystemChrome.setEnabledSystemUIOverlays([]);
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    widget.filePath;
    return Scaffold(
        body: Stack(
      children: [
        Container(
          width: double.infinity,
          height: double.infinity,
          color: Colors.black87,
          child: Align(alignment: Alignment.topCenter, child: Image.file(File(widget.filePath)),),
        ),
        Positioned(
          bottom: 16,
          left: 16,
          child: GestureDetector(
            child: Image.asset(
              "assets/images/camera_photo_back.webp",
              width: 96,
              height: 96,
            ),
            onTap: () {
              Get.back();
            },
          ),
        ),
        Positioned(
          bottom: 16,
          right: 16,
          child: GestureDetector(
            child: Image.asset(
              "assets/images/camera_photo_done.webp",
              width: 96,
              height: 96,
            ),
            onTap: () {
              Get.back(result: "done");
            },
          ),
        )
      ],
    ));
  }

  @override
  void dispose() {
    // SystemChrome.setEnabledSystemUIOverlays(SystemUiOverlay.values);
    super.dispose();
  }
}
